package com.example.backend.repository;


import com.example.backend.entity.Vehicle;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Optional;

public interface VehicleRepository extends JpaRepository<Vehicle,Integer>, CrudRepository<Vehicle,Integer> { //T 需要类型化为实体类(Entity)Vehicle，ID需要实体类Vehicle中Id的类型

    @Override
    Optional<Vehicle> findById(Integer id); //Optional类，如果值存在则 isPresent()方法会返回 true
    List<Vehicle> findByVehicleCategory(String vehicleCategory);
    List<Vehicle> findByName(String name);
    List<Vehicle> findByBuyDate(String buyDate);
    List<Vehicle> findByStatus(String status);
    List<Vehicle> findByRent(Integer rent);
    List<Vehicle> findByLicenseNumber(String licenseNumber);
}
